package file.day9_30;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FlushDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("bos.txt");
        BufferedOutputStream bos = new BufferedOutputStream(fos);

        String line = "爱你孤身走暗巷";

        bos.flush();

        bos.write(line.getBytes(StandardCharsets.UTF_8));

        bos.close();//close里面有一次flush。
    }
}
